$("#t7").click(function () {
    console.log("t7 点击...")
    if ($("#t7").text() === '开启') {
        // $("#t7").text("关闭");
        chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
            let debuggeeId = { tabId: tabs[0].id }
            console.log(debuggeeId)
            chrome.debugger.attach(debuggeeId, '1.2', function() {
                chrome.debugger.sendCommand(debuggeeId, "Debugger.enable", {}, function() {
                    console.log("-----开启------")
                })
            })
        });
    } else {
        // 关闭不了
        // $("#t7").text("开启");
        // console.log(debuggeeId)
        // chrome.debugger.detach(debuggeeId, function() {
        //     chrome.debugger.sendCommand(debuggeeId, "Debugger.disable", {}, function() {
        //         console.log("------关闭-----")
        //     })
        // })
    }
})
$("#t8").click(function () {
    console.log("t8 点击...")
    sendMessageToContentScript({cmd:'find8', value:'测试事件'}, function(response) {
        console.log('回复：'+response);
    });
})

// 向content.js 发送信息
function sendMessageToContentScript(message, callback) {
    chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
        chrome.tabs.sendMessage(tabs[0].id, message, function(response)
        {
            if(callback) callback(response);
        });
    });
}